package saeildamil.ch18.critical;

public class Account {
	String accountNo;
	String ownetName;
	int balance;
	
	
	public Account(String accountNo, String ownetName, int balance) {
		this.accountNo = accountNo;
		this.ownetName = ownetName;
		this.balance = balance;
	}
	void deposit(int amount){
		balance += amount;
	}
	int withdraw(int amount) throws Exception{
		if(balance < amount)
			throw new Exception("잔액부족");
		balance -= amount;
		return amount;
	}
}
